{include file="public/nheader" /}
<div class="layui-fluid">
    <div class="layui-card">
        <!-- // 默认操作按钮 -->
        <div class="layui-card-header layadmin-card-header-auto ">
            <div class="layui-form">
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <div class="layui-input-inline ">
                            <input name="title" class="layui-input" type="text" placeholder="用户名|身份证|手机号" />
                        </div>
                    </div>
                    <div class="layui-inline">
                        <div class="layui-input-inline ">
                            <select name="status">
                                <option value="">状态</option>
                                <option value="1" {if !empty(input('get.status')) &&
                                    input('get.status')==1}selected{/if}>在线</option>
                                <option value="2" {if !empty(input('get.status')) &&
                                    input('get.status')==2}selected{/if}>忙碌</option>
                                <option value="3" {if !empty(input('get.status')) &&
                                    input('get.status')==3}selected{/if}>下线</option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <div class="layui-input-inline ">
                            <select name="province" lay-filter="province">
                                <option value="">请选择搜索省份</option>
                                {foreach $province as $v}
                                <option value="{$v.area_code}" {if !empty(input('get.province')) &&
                                    input('get.province')==$v.area_code}selected{/if}>{$v.name}</option>
                                {/foreach}
                            </select>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <div class="layui-input-inline ">
                            <select name="city" lay-filter="city">
                                <option value="">请选择搜索城市</option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <div class="layui-input-inline ">
                            <select name="area" lay-filter="area">
                                <option value="">请选择搜索区域</option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <div class="layui-input-inline ">
                            <select name="street" lay-filter="street">
                                <option value="">请选择搜索街道</option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <!-- // 默认搜索 -->
                        <button class="layui-btn icon-btn" lay-filter="formSearch" lay-submit>搜索</button>
                        <!-- // 删除所有 -->
                        <button class="layui-btn icon-btn layui-btn-danger" lay-batch="lay-tableList"
                            data-url="/agent/rider_del">批量删除
                        </button>
                    </div>
                </div>
            </div>
        </div>

        <!-- // 创建数据实例 -->
        <table id="lay-tableList" lay-filter="lay-tableList"></table>
    </div>
</div>
<!-- // 列表工具栏 -->
<script type="text/html" id="tableBar">
    <a class="layui-table-text" lay-open data-title="编辑" data-area="60%,80%" data-url="/agent/rider_edit?id={{d.id}}" >编辑</a>
    <div class="layui-divider layui-divider-vertical"></div>
    <a class="layui-table-text" lay-open data-title="管理街道" data-area="90%,90%" data-url="/agent/riderstreet?rider={{d.id}}" >管理街道</a>
    <div class="layui-divider layui-divider-vertical"></div>
    <a class="layui-table-text" data-url="/agent/rider_del?id={{d.id}}" lay-event="del">删除</a>
</script>
{include file="public/nfooter"}
<script>
    layui.use(['table'], function () {
        var table = layui.table;        // 表格
        /*
         * 初始化表格
        */
        var isTable = table.render({
            elem: "#lay-tableList",
            where: {
                agentid: "{:input('agentid/d',0)}"
            }
            , url: "{:url()}"
            , page: true
            , size: 'lg'
            , even: true
            , cols: [[
                { type: 'checkbox', width: 60 },
                { field: 'id', align: 'center', sort: true, width: 80, title: 'ID' },
                {
                    field: 'status', align: 'center', width: 120, templet: function (d) {
                        var text = '';
                        if (d.status == 1) {
                            text = '<span class="layui-badge layui-bg-blue">在线</span>';
                        }
                        if (d.status == 2) {
                            text = '<span class="layui-badge layui-bg-orange">忙碌</span>';
                        }
                        if (d.status == 3) {
                            text = '<span class="layui-badge layui-bg-green">下线</span>';
                        }
                        return text;

                    }, title: '类型'
                },
                { field: 'name', align: 'center', width: 120, title: '名称' },
                { field: 'cards', width: 200, align: 'center', title: '身份证' },
                { field: 'mobile', width: 150, align: 'center', title: '手机号' },
                {
                    field: 'money', align: 'center', width: 120, templet: function (d) {
                        return '<a style="color:blue" class="layui-table-text" lay-open data-title="完成" data-area="90%,90%" data-url="/orders/index?riderid=' + d.id + '&status=4" >'+d.count+'单/' +d.total+'元</a>';
                    }, title: '订单'
                },
                {
                    field: 'positive', align: 'center', width: 100, templet: function (d) {
                        return d.positive ? '<div><img style="width:50px" src="' + d.positive + '"lay-image-click=""></div>' : '<div></div>';
                    }, title: '身份证正面'
                },
                {
                    field: 'negative', align: 'center', width: 100, templet: function (d) {
                        return d.negative ? '<div><img style="width:50px" src="' + d.negative + '"lay-image-click=""></div>' : '<div></div>';
                    }, title: '身份证反面'
                }, { field: 'created', width: 150, align: 'center', title: '注册时间' },
                { align: 'center', toolbar: '#tableBar', width: 250, title: '操作' },
            ]]
        })
    })
</script>
</body>